﻿package com.victim.snake.graphics.mainClass.chat
{
	
	import com.victim.snake.util.Loader;
	import com.victim.snake.user.User;
	import flash.events.Event;
	import flash.display.LoaderInfo;
	import flash.display.Bitmap;
	import com.victim.snake.style.MainChatTrackUpSkin;
	import com.victim.snake.style.MainUpArrowUpSkin;
	import com.victim.snake.style.MainUpArrowOverSkin;
	import com.victim.snake.style.MainDownArrowUpSkin;
	import com.victim.snake.style.MainDownArrowOverSkin;
	import com.victim.snake.style.MainThumbUpSkin;
	import com.victim.snake.style.MainThumbOverSkin;
	import com.victim.snake.style.ComboBoxUpSkin;
	import com.victim.snake.style.ChatComboBoxUpSkin;
	
	
	//聊天室图片资源下载
	public class ImageLoader
	{
		static public var trackUpSkin:Bitmap=null;
		static public var upArrowUpSkin:Bitmap=null;
		static public var upArrowOverSkin:Bitmap=null;
		static public var downArrowUpSkin:Bitmap=null;
		static public var downArrowOverSkin:Bitmap=null;
		static public var thumbUpSkin:Bitmap=null;
		static public var thumbOverSkin:Bitmap=null;
		static public var comboBoxUpSkin:Bitmap=null;
		
		
		//下载轨道背景
		static public function trackUpSkinLoader():void{
			new Loader("image/main/chat/trackUpSkin.png",trackUpSkinEvent);	
		}
		
		//下载滚动条向上按钮
		static public function upArrowUpSkinLoader():void{			
			new Loader("image/main/chat/upArrowUpSkin.png",upArrowUpSkinEvent);	
		}
		
		//下载滚动条鼠标在其上时向上按钮
		static public function upArrowOverSkinLoader():void{			
			new Loader("image/main/chat/upArrowOverSkin.png",upArrowOverSkinEvent);	
		}
		
		//下载滚动条向下按钮
		static public function downArrowUpSkinLoader():void{			
			new Loader("image/main/chat/downArrowUpSkin.png",downArrowUpSkinEvent);	
		}
		
		//下载滚动条鼠标在其上时向上按钮
		static public function downArrowOverSkinLoader():void{			
			new Loader("image/main/chat/downArrowOverSkin.png",downArrowOverSkinEvent);	
		}
		
		//下载滚动条滚动按钮
		static public function thumbUpSkinLoader():void{			
			new Loader("image/main/chat/thumbUpSkin.png",thumbUpSkinEvent);	
		}
		
		//下载滚动条鼠标在其上时滚动按钮
		static public function thumbOverSkinLoader():void{			
			new Loader("image/main/chat/thumbOverSkin.png",thumbOverSkinEvent);	
		}
		
		//下载频道选择下拉框背景
		static public function comboBoxUpSkinLoader():void{			
			new Loader("image/main/chat/comboBoxUpSkin.png",comboBoxUpSkinEvent);	
		}
		
		//设置频道选择下拉框背景
		static function comboBoxUpSkinEvent(event:Event):void{
			var loaderInfo:LoaderInfo=LoaderInfo(event.target);
			ImageLoader.comboBoxUpSkin=Bitmap(loaderInfo.content);
			User.getChatSprite().comboBox.setStyle("upSkin",ChatComboBoxUpSkin);
		}
		
		//设置轨道背景
		static function trackUpSkinEvent(event:Event):void{
			var loaderInfo:LoaderInfo=LoaderInfo(event.target);
			ImageLoader.trackUpSkin=Bitmap(loaderInfo.content);
			User.getChatSprite().scrollBar.setStyle("trackUpSkin",MainChatTrackUpSkin);
			User.getChatSprite().scrollBar.setStyle("trackOverSkin",MainChatTrackUpSkin);
			User.getChatSprite().scrollBar.setStyle("trackDownSkin",MainChatTrackUpSkin);
			User.getChatSprite().scrollBar.setStyle("trackDisabledSkin",MainChatTrackUpSkin);
		}
		
		//设置滚动条向上按钮
		static function upArrowUpSkinEvent(event:Event):void{
			var loaderInfo:LoaderInfo=LoaderInfo(event.target);
			ImageLoader.upArrowUpSkin=Bitmap(loaderInfo.content);
			User.getChatSprite().scrollBar.setStyle("upArrowUpSkin",MainUpArrowUpSkin);
			User.getChatSprite().scrollBar.setStyle("upArrowDisabledSkin",MainUpArrowUpSkin);
			User.getChatSprite().scrollBar.setStyle("upArrowDownSkin",MainUpArrowUpSkin);
		}
		
		//设置滚动条鼠标在其上时向上按钮
		static function upArrowOverSkinEvent(event:Event):void{
			var loaderInfo:LoaderInfo=LoaderInfo(event.target);
			ImageLoader.upArrowOverSkin=Bitmap(loaderInfo.content);
			User.getChatSprite().scrollBar.setStyle("upArrowOverSkin",MainUpArrowOverSkin);
		}
		
		//设置滚动条向下按钮
		static function downArrowUpSkinEvent(event:Event):void{
			var loaderInfo:LoaderInfo=LoaderInfo(event.target);
			ImageLoader.downArrowUpSkin=Bitmap(loaderInfo.content);
			User.getChatSprite().scrollBar.setStyle("downArrowUpSkin",MainDownArrowUpSkin);
			User.getChatSprite().scrollBar.setStyle("downArrowDisabledSkin",MainDownArrowUpSkin);
			User.getChatSprite().scrollBar.setStyle("downArrowDownSkin",MainDownArrowUpSkin);
		}
		
		//设置滚动条鼠标在其上时向下按钮
		static function downArrowOverSkinEvent(event:Event):void{
			var loaderInfo:LoaderInfo=LoaderInfo(event.target);
			ImageLoader.downArrowOverSkin=Bitmap(loaderInfo.content);
			User.getChatSprite().scrollBar.setStyle("downArrowOverSkin",MainDownArrowOverSkin);
		}
		
		//设置滚动条滚动按钮
		static function thumbUpSkinEvent(event:Event):void{
			var loaderInfo:LoaderInfo=LoaderInfo(event.target);
			ImageLoader.thumbUpSkin=Bitmap(loaderInfo.content);
			User.getChatSprite().scrollBar.setStyle("thumbUpSkin",MainThumbUpSkin);			
			User.getChatSprite().scrollBar.setStyle("thumbDisabledSkin",MainThumbUpSkin);
		}
		
		//设置滚动条鼠标在其上时滚动按钮
		static function thumbOverSkinEvent(event:Event):void{
			var loaderInfo:LoaderInfo=LoaderInfo(event.target);
			ImageLoader.thumbOverSkin=Bitmap(loaderInfo.content);
			User.getChatSprite().scrollBar.setStyle("thumbOverSkin",MainThumbOverSkin);
			User.getChatSprite().scrollBar.setStyle("thumbDownSkin",MainThumbOverSkin);
		}
		
		public function ImageLoader(){
			
		}
		
	}
}